/*
 * @Author: your name
 * @Date: 2021-07-07 15:01:29
 * @LastEditTime: 2022-08-03 18:00:17
 * @LastEditors: 11 11
 * @Description: In User Settings Edit
 * @FilePath: \exc-tl1-2\SRC\gpio.c
 */
/**
	********************************************************************************
	*
	*文件名称：
	*
	*文件日期：
	*
	*文件描述：
	*
	*文件版本：
	*
	*修改历史：
	*
	********************************************************************************
***/

/*******************************	头文件包含区	**********************************/
#include "gpio.h"

/******************************* 全局变量定义区 **********************************/

/**
	*********************************************************************************
	*
	*函数名称：
	*
	*函数参数：无
	*
	*函数返回值：无
	*
	*功能描述：
	*
	*********************************************************************************
**/

static void Gpio_Int(void)
{
// GPIO->PMA |= 1 << 30;
// GPIO->PCA1 |= 1 << 12;
// GPIO->PUA |= 1 << 30;
// GPIO->PIEA &= ~(1 << 30);
 
// INTC->CTRL |=  1 << 6;
// //INTC->MODE |= 1 << 12;
// INTC->MODE |= 0 << 12;
// INTC->MASK |= 1 << 6;
// NVIC_EnableIRQ(EXT6_IRQn);
}

void sys_gpioInit(void)
{
	//PA脚

	GPIO->PA |= 0x00000000;

	GPIO->PMA = 0xfb75fcf1; // p0.0 Rst(ZB)  p0.1 SET p0.2 evenout p0.3 LVD p0.4 JDQ_TEST  0x  Fb 05 Fc ef


	GPIO->PUA = 0xFb05Fce5;
	GPIO->PIMA = 0;			 // P1.0 TURN P1.1 UP_OVER

	GPIO->PCA0 = 0x6600140f; // P2.0 RXD P2.1 TXD P2.2 IR_RXD P2.3 IR_TXD P2.4 STA P2.5 SWDIO P2.6 RXD3 P2.7 TXD3 0x 26 00 14 33
	GPIO->PCA1 = 0x00000000; // P3.2 SP(RTC)

	GPIO->PIEA = 0xffeAffe2;
	
	//PB脚

	GPIO->PB = 0x00002000;

	GPIO->PMB = 0x0;
	GPIO->PUB = 0x00003000;
	GPIO->PCB = 0x0;
	GPIO->PIEB = 0;


	//PC脚
	GPIO->PC = 0x0000000f;
	GPIO->PMC = 0x0;
	//GPIO->PUC = 0x0000001B;
	GPIO->PUC = 0x0000003B;
	GPIO->PCC = 0x0;
	GPIO->PIEC = 0xffffffff;

	Gpio_Int();
	POWER_ON(RESET);
//	POWER_ON(SET);
	POWER_KEY(RESET);
	RED_SET;
	BLUE_SET;
	
	GPIO->PCSET |= 1 << 1;
	LAMP1_RESET;
}
